home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / text / edit / CedBar.lha / CedBar / CedClip.g < prev    next >
Text File  |  1999-05-10  |  4KB  |  157 lines

  1. G4C
  2.  
  3. ;       CedClip.g - clipboard viewer
  4. ; --------------------------------------------------------
  5.  
  6. WINBIG 143 21 407 190 'Clipboard Viewer'
  7. WinType 11110001
  8.  
  9. xOnLoad
  10. setgad cedclip.g 11 hide ; hide 2nd lv
  11.  
  12. BOX 0 0 407 25 in ICONDROP
  13.  
  14. ; --------------------------------------------------------
  15. ;       Change the clipboard unit
  16. ; --------------------------------------------------------
  17.  
  18. xIcon 292 6 :icons/left
  19. --cedbar.gc/cedClip
  20. gosub CedClip.g changeunit
  21.  
  22. xIcon 366 6 :icons/right
  23. ++cedbar.gc/cedClip
  24. gosub CedClip.g changeunit
  25.  
  26. XTEXTIN 309 5 53 14 "" unit '0' 10
  27. gadid 2
  28. gosub CedClip.g changeunit
  29.  
  30. xRoutine ChangeUnit
  31. ; make sure the cedbar.gc/cedClip is 0-255
  32. if $cedbar.gc/cedClip > 255
  33.    cedbar.gc/cedClip = 0
  34. elseif $cedbar.gc/cedClip < 0
  35.    cedbar.gc/cedClip = 255
  36. endif
  37. ; load the given clip..
  38. lvuse CedClip.g 1
  39. lvchange "CLIPS:$cedbar.gc/cedClip"
  40.  
  41. ; update the text gad
  42. update CedClip.g 2 $cedbar.gc/cedClip
  43.  
  44. ; and update cedbar.gc also..
  45. update cedbar.gc 1 $cedbar.gc/cedClip
  46. cedbar.gc/cedSend = "set clipboard unit "
  47. AppVar cedbar.gc/cedSend $cedbar.gc/cedClip
  48. SendRexx $cedbar.gc/cedport $cedbar.gc/cedSend
  49.  
  50. ; --------------------------------------------------------
  51. ;       Load a file into the current clipboard unit
  52. ; --------------------------------------------------------
  53.  
  54. xIcon 10 5 :icons/Open
  55. ReqFile  -1 -1 300 -30 'Choose file :' LOAD filename ''
  56. if $filename > ''
  57.    lvuse CedClip.g 1
  58.    lvchange $filename
  59.    ; now save it so as to write it to the clipboard
  60.    lvsave 'CLIPS:$cedbar.gc/cedClip'
  61. endif
  62.  
  63. ; --------------------------------------------------------
  64. ;       Save the current clipboard unit as a file
  65. ; --------------------------------------------------------
  66.  
  67. xIcon 40 5 :icons/save
  68. ReqFile  -1 -1 300 -30 'Save as file :' SAVE savename ''
  69. if $savename > ' '
  70.    ifexists file $savename
  71.       ezreq 'File $savename exists.\nOverwrite ?' Overwrite|CANCEL choice
  72.       if $choice = 0
  73.          stop
  74.       endif
  75.    endif
  76.    lvsave $savename
  77. endif
  78.  
  79. ; --------------------------------------------------------
  80. ;       Clear the current clipboard unit
  81. ; --------------------------------------------------------
  82.  
  83. xIcon 70 5 :icons/Clear
  84. lvuse CedClip.g 1
  85. lvclear
  86. ; update the clipboard
  87. lvsave 'CLIPS:$cedbar.gc/cedClip'
  88.  
  89. ; --------------------------------------------------------
  90. ;       Cut 
  91. ; --------------------------------------------------------
  92.  
  93. xIcon 110 5 :icons/cut
  94. guiwindow cedclip.g wait
  95. setgad cedclip.g 1 hide ; hide for speed
  96. lvuse cedclip.g 11
  97. lvclear
  98. lvuse cedclip.g 1
  99. lvmulti first
  100. while $$lv.line > ''
  101.    lvclip cut 1 add cedclip.g 11
  102.    lvmulti next
  103. endwhile
  104. setgad cedclip.g 1 show
  105. lvmulti show
  106. ; write it to the clipboard
  107. lvsave 'CLIPS:$cedbar.gc/cedClip'
  108. guiwindow cedclip.g resume
  109.  
  110. ; --------------------------------------------------------
  111. ;       Copy
  112. ; --------------------------------------------------------
  113.  
  114. ; almost same as above..
  115. xIcon 140 5 :icons/copy
  116. guiwindow cedclip.g wait
  117. setgad cedclip.g 1 hide ; hide for speed
  118. lvuse cedclip.g 11
  119. lvclear
  120. lvuse cedclip.g 1
  121. lvmulti first
  122. while $$lv.line > ''
  123.    lvclip copy 1 add cedclip.g 11
  124.    lvmulti next
  125. endwhile
  126. setgad cedclip.g 1 show
  127. lvmulti show
  128. lvsave 'CLIPS:$cedbar.gc/cedClip'
  129. guiwindow cedclip.g resume
  130.  
  131. ; --------------------------------------------------------
  132. ;       Paste - Insert records after CURRENT record
  133. ; --------------------------------------------------------
  134.  
  135. xIcon 170 5 :icons/paste
  136. guiwindow cedclip.g wait
  137. lvuse cedclip.g 11
  138. lvgo first
  139. lvclip copy -1 insert cedclip.g 1
  140. lvuse cedclip.g 1
  141. lvsave 'CLIPS:$cedbar.gc/cedClip'
  142. guiwindow cedclip.g resume
  143.  
  144. ; --------------------------------------------------------
  145. ;       The listviews
  146. ; --------------------------------------------------------
  147.  
  148. XLISTVIEW 1 25 405 164 "" clipline CLIPS:0 10 MULTI
  149. gadid 1
  150.  
  151. ; hiden listview - use it as my clip holder
  152. XLISTVIEW 1 25 405 164 "" lv11 '' 10 MULTI
  153. gadid 11
  154.  
  155.  
  156.  
  157.